<?php
 /******************************************************************************
 *   GunCMS is an avid supporter of open source software. This is the appropriate 
 *   option if you are creating an open source application with a license 
 *   compatible with the GNU GPL license v3.
 *   For details http://www.gnu.org/licenses/gpl.html
 *   DO NOT USE FOR COMMERCIAL WITHOUT PERMISSION
 *
 * GunCMS Version 1.0.3
 * Copyright(c) 2009-2010, T & L GdbR
 * info@guncms.de
 * 
 * http://www.guncms.de
 ********************************************************************************/
ob_start();
session_start();
$_SESSION["LC_ALL"] = 'en';
require_once("configuration.php");
require_once("includes/db/constants.php");
require_once("admin/includes/util.php");

require_once("model/FgcmsConfigBean.class.php");
require_once("model/FgcmsCategoryBean.class.php");
require_once("model/FgcmsPageBean.class.php");
include_once("model/FgcmsTemplateBean.class.php");
include_once("model/FgcmsNewsBean.class.php");

$templ = FgcmsTemplateBean::get_active_template($db);
define("TEMPLATE_NAME", $templ->name);

require_once("includes/MySmarty.class.php");

include_once("controller/FgcmsConfig.class.php");
include_once("controller/FgcmsContact.class.php");
include_once("controller/FgcmsCategory.class.php");
include_once("controller/FgcmsPage.class.php");
include_once("controller/FgcmsTemplate.class.php");
include_once("controller/FgcmsNews.class.php");

$smarty->assign("TEMPLATE_NAME_PATH", TEMPLATE_NAME);


$template = new FgcmsTemplate($db, $smarty);
$template->process();
$smarty->clear_all_cache();

$config = new FgcmsConfig($db, $smarty);
$config->view_config();

$listcat = new FgcmsCategory($db, $smarty);
$listcat->default_category();
$listcat->view_top_category();
$listcat->view_left_category();
$listcat->view_menubar();

/*	show all news in right side
*/ 
$news = new FgcmsNews($db, $smarty);
$news->shownews();
$news->showallnews();

if($_GET['page']=='sitemap') {
	$listcat->view_sitemap();
} else if($_GET['page']=='contact'){
	$contact = new FgcmsContact($db, $smarty);
	$contact->view_formcontact();
}

$viewpage = new FgcmsPage($db, $smarty);
$viewpage->view_page();

$smarty->display("index.tpl");
?>
